package com.test;

import com.mapper.Student;
import org.apache.ibatis.session.SqlSession;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;

public class StudentTest {
    @Test
    public void findStudentByNameOrMajorTest() {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        Student student = new Student();
        student.setSid(1);
        List<Student> students = sqlSession.selectList("findStudentByNameOrMajor", student);
        for (Student stud : students) {
            System.out.println(stud);
        }
        sqlSession.close();
    }
    @Test
    public void findStudentByIdsTest() {
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        List<Long> studentIds = Arrays.asList(1L, 2L, 3L);
        List<Student> students = sqlSession.selectList("findStudentByIds", studentIds);
        for (Student student : students) {
            System.out.println(student);
        }
        sqlSession.close();
    }
}
